//
//  TasbihHistoryController.m
//  Beads
//
//  Created by CPX on 2018/11/1.
//  Copyright © 2018 cpx. All rights reserved.
//

#import "TasbihHistoryController.h"
#import "TasbihLogListController.h"
@interface TasbihHistoryController ()
<
WMPageControllerDelegate,
WMPageControllerDataSource
>
@property (nonatomic,assign)NSInteger showType;/**<查看类型 0 -- day 1 -- month 2 -- year */
@end

@implementation TasbihHistoryController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(instancetype)init{
    if (self = [super init]){
        self.titleSizeNormal = 16;
        self.titleSizeSelected = 17;
        self.menuViewStyle = WMMenuViewStyleLine;
        self.automaticallyCalculatesItemWidths = YES;
        self.menuViewLayoutMode = WMMenuViewLayoutModeLeft;
        self.pageAnimatable = YES;
        self.titleColorSelected = UIColorHex(#00732F);
        self.titleColorNormal = UIColor.blackColor;
        self.progressColor = UIColorHex(#00732F);
        self.menuViewContentMargin = 5;
        self.itemMargin = 20;
        
    }
    return self;
}

- (void)initViews{
  
}
- (void)initNavigation{
    [self initDefaultNavigation];
    [self.myNavigationBar.backButton setTitle:@"Statistical" forState:UIControlStateNormal];
    self.showType = 0;
    [self.myNavigationBar.rightButton1 addTarget:self action:@selector(changeShowType) forControlEvents:UIControlEventTouchUpInside];
    [self.myNavigationBar.rightButton2 setImage:[UIImage imageNamed:@"calendar_location"] forState:UIControlStateNormal];
    [self.myNavigationBar.rightButton1 addTarget:self action:@selector(locationCurrent) forControlEvents:UIControlEventTouchUpInside];

    

    
}
#pragma mark - Datasource & Delegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return 2;
    
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    return [TasbihLogListController new];
  
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return @"05/2018";
}
- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    return CGRectMake(0, NavHeight, kScreenWidth, 45);
    
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    return CGRectMake(0, NavHeight + 45, kScreenWidth, kScreenHeight - NavHeight - 45);
    
}
#pragma mark ---- event touc
-(void)changeShowType{
    self.showType += 1;
    if (_showType == 3){
        self.showType = 0;
    }
    
}
-(void)locationCurrent{
    
}




#pragma mark ---设置当前查看类型
- (void)setShowType:(NSInteger)showType{
    _showType = showType;
    switch (showType) {
        case 0:
        {
            [self.myNavigationBar.rightButton1 setImage:[UIImage imageNamed:@"calendar_day"] forState:UIControlStateNormal];
            break;
        }
        case 1:
        {
            [self.myNavigationBar.rightButton1 setImage:[UIImage imageNamed:@"calendar_moth"] forState:UIControlStateNormal];
            break;
        }
        case 2:
        {
            [self.myNavigationBar.rightButton1 setImage:[UIImage imageNamed:@"calendar_year"] forState:UIControlStateNormal];
            break;
        }
            
        default:
            break;
    }
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
